# !/usr/bin/env python
"""
    blueprint_y
    ~~~~~~~


    :Author: swq
    :Date: 2021/07/04 14:39 
"""
from flask import Blueprint, jsonify, request

blueprint_y = Blueprint(name="blueprint_y", import_name=__name__)

y = 1000


@blueprint_y.route('/test', methods=['GET'], endpoint='test')
def test():
    output = {"msg": "I'm the test endpoint from blueprint_y."}
    return jsonify(output)


@blueprint_y.route('/minus', methods=['POST'], endpoint='minus_y')
def minus_y():
    data = request.get_json()
    in_val = data['number']
    result = in_val - y
    output = {"msg": f"Your result is: '{result}'"}
    return jsonify(output)
